import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

export default new Vuex.Store({

  state: {
    osshttp: 'http://www.zhihuinewlife.com/zh/',
    imgPlaceHolder: '',
    userInfo: {},
    toUser: 'gh_2f516b23bfba',
    hasNewOrder: false,
    ossimg:'https://psimg.oss-cn-beijing.aliyuncs.com/'

  },
  mutations: {
    setUserInfo(state, userInfo) {
      state.userInfo = userInfo;
    },
    setHasNewOrderState(state, falg) {
      state.hasNewOrder = falg;
    }
  },
  actions: {
    setUserInfo(context, userInfo) {
      context.commit('setUserInfo', userInfo)
    },
    logout(context, userInfo) {
      context.commit('setUserInfo', {})
    },
    setHasNewOrderState(context, falg) {
      context.commit('setHasNewOrderState', falg)
    }
  }
})
